<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>修改密码</title>
<script src="/res/js/common/jquery.1.9.1.min.js"  ></script>
<script src="/res/js/common/common.js" type="text/javascript"></script>
<link href="/res/css/respective/safecenter/back-safe.css" rel="stylesheet">
</head>
[#assign menucode="resetPassword"/]
<body>
	<div class="warp">
    [#include "/front/common/front_headAzt.html"]
         <div class="backcontent">
      [#include "/front/common/front_leftAzt.html"]
            <div class="back-main">
            	<div class="inner back-safe">
                	 <div class="title">修改密码</div>
                	 <form id="passwordForm">
                     <div class="safeform passwordform">
                          <ul>
                          	<li>
                            	<label><i class="orange">*</i>当前密码：</label>
                                <div class="formfile">
                                	<input type="password" class="backinput" name="password" autocomplete="off" readonly="true" onfocus="javascript:this.readOnly=false" data-rule="required;password;vlidatePassword" data-rule-password="[/^[^ ]{6,20}$/,'请填写6-20位字符，不能包含空格']" value="" placeholder="请输入当前密码" onpaste="return false" oncontextmenu="return false" oncopy="return false" oncut="return false" />
                                </div>
                            </li>
                            <li>
                            	<label><i class="orange">*</i>新密码：</label>
                                <div class="formfile">
                                	<input type="password" class="backinput" name="newpassword" autocomplete="off" data-rule="required;password" data-rule-password="[/^[^ ]{6,20}$/,'请填写6-20位字符，不能包含空格']" value=""  placeholder="6-20个字符，字母、数字、符号组成" onpaste="return false" oncontextmenu="return false" oncopy="return false" oncut="return false" />
                                </div>
                            </li>
                            <li>
                            	<label><i class="orange">*</i>确认密码：</label>
                                <div class="formfile">
                                	<input type="password" class="backinput" name="newpassword2" autocomplete="off" data-rule="required;password;match[newpassword]" data-msg-match="确认密码不一致" data-rule-password="[/^[^ ]{6,20}$/,'请填写6-20位字符，不能包含空格']"  value=""  placeholder="请再次输入新密码" onpaste="return false" oncontextmenu="return false" oncopy="return false" oncut="return false" />
                                </div>
                            </li>
                            <li>
                            	<label>&nbsp;</label>
                                <div class="formfile">
                                	<a href="javascript:void(0);" onclick="savepassword();" class="abtn abtn-large">保存</a>
                                </div>
                            </li>
                          </ul>
                     </div>
                     </form>
                </div>
            </div>
         </div>
         
 		<!-- 底部菜单-->
		[#include "/front/common/front_footerAzt.html"]
    </div>
    <script src="/res/third/nice-validator/jquery.validator.js?local=zh-CN"></script>
    <script type="text/javascript">
    //校验密码
    	$("#passwordForm").validator({
    		theme:'simple_right',
			timely: 1,
			stopOnError: true,
			    rules: {
			    	vlidatePassword:function(){
			    		var password=$("input[name='password']").val();
			    		return $.ajax({
							type : "post",
							dataType : "json",
							url : "/safecenter/vlidatePassword",
							data :{'password':password},
							success : function(data) {
								
							}
						});
			    	}
			    },
			    fields: {
			    	'password':"required;vlidatePassword"
			    },
			    messages: {
			    }
    	});
    	
    
    function savepassword(){
    	$("#passwordForm").isValid(function(){
    		//提交
    		var password=$("input[name='password']").val();
    		var newpassword=$("input[name='newpassword']").val();
    		$.ajax({
					type : "post",
					dataType : "json",
					url : "/safecenter/savepassword",
					data :{password:password,newpassword:newpassword},
					success : function(data) {
						if(data.success){
							 me=false;
							 location.href="/safecenter/resetpasswordsuccess";
						}else{
							me=true;
							 layer.msg(data.msg , {time:2000});
						}
					}
    	});
    });
  }
</script>
</body>
</html>
